package eclipse1;

public class Student {
    int id;
    String name;
    String gender;
    int age;

    public Student(){

    }
    public Student(int id, String name){
        this(id,name,null);
    }
    public Student(int id, String name, String gender){
        //从构造方法调用另一个重载的构造方法
        //目的是减少代码重复
        this(id, name, gender, 0);
    }
    public Student(int id, String name, String gender, int age){
        this.id = id;
        this.name = name;
        this.gender = gender;
        this.age = age;
    }

    @Override
    public String toString(){
        return "学号:"+id+",姓名:"+name+",性别:"+gender+",年龄"+age;
    }
}
